<?php

	// +----------------------------------------------------------------------
	// | 认证提交
	// +----------------------------------------------------------------------
	// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
	// +----------------------------------------------------------------------
	// | Author: 微尘 <yicmf@qq.com>
	// +----------------------------------------------------------------------

	namespace app\model\store;


	class StoreApp extends Common
	{

		/**
		 * 写入修改
		 * @param $data
		 */
		public static function onAfterWrite($data)
		{

		}


		/**
		 * 写入修改
		 * @param $data
		 */
		public static function onBeforeWrite($data)
		{
			$data['is_default'] = 1;
		}

		/**
		 * 写入修改
		 * @param $data
		 */
		public static function onBeforeInsert($data)
		{
            $data['app_key'] = md5(uniqid());
            $data['status'] = 1;
		}

		public function store()
		{
			return $this->belongsTo(Store::class);
		}
        protected $type = [
            'theme'      =>  'array',
        ];
	}
